package com.llsly.wearabledataviz.repository;

import com.llsly.wearabledataviz.model.WearableData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface WearableDataRepository extends JpaRepository<WearableData, Long> {
    List<WearableData> findByDeviceIdAndTimestampBetween(String deviceId, LocalDateTime start, LocalDateTime end);
    
    @Query("SELECT w FROM WearableData w WHERE w.isAnomaly = true AND w.timestamp BETWEEN ?1 AND ?2")
    List<WearableData> findAnomaliesBetween(LocalDateTime start, LocalDateTime end);
} 